package com.qumitech.visualnovel.controller.rest;


import com.qumitech.visualnovel.model.common.BaseRsp;
import com.qumitech.visualnovel.model.common.ResultEnum;
import com.qumitech.visualnovel.pubdef.dto.tip.TipAdminDTO;
import com.qumitech.visualnovel.pubdef.dto.tip.TipQueryDTO;
import com.qumitech.visualnovel.service.tip.TipService;
import com.google.common.collect.ImmutableMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author :  ZhChNing
 * @Descriptiom :
 * @Date Created in 2019/7/30 10:05
 */

@RestController
@RequestMapping("/api/tip")
public class TipController {
    @Autowired
    private TipService tipService;

    // @RequireWhiteList
    @GetMapping("/list")
    public BaseRsp getTipList(TipQueryDTO queryDTO) {

        return new BaseRsp(ResultEnum.SUCCESS, tipService.getTipList(queryDTO));
    }

    @PutMapping("/{tip_id}")
    public BaseRsp updateTip(@RequestBody TipAdminDTO tipAdminDTO, @PathVariable(name = "tip_id") String tipId) {
        tipAdminDTO.setTipId(tipId);
        tipService.updateTip(tipAdminDTO);
        return new BaseRsp(ResultEnum.SUCCESS);
    }


}
